/*
 * @Author: cgl
 * @Date: 2023-04-19 14:57:57
 * @LastEditors: cgl
 * @LastEditTime: 2023-05-13 09:31:33
 * @FilePath: \public-health-emergencies-fed:\radiation-hygiene-fe\src\api\slides\contractTask.js
 * @Description:
 *
 * Copyright (c) 2023 by cgl/微盛信息产业有限公司, All Rights Reserved.
 */
import request from '@/utils/request'

// 审核任务
export function contractProcess(data) {
  return request({
    url: '/task/contract/process',
    method: 'post',
    data,
    headers: {
			isLoading: true,
		}
  })
}
// 修改合同任务
export function contractEdit(data) {
  return request({
    url: '/task/contract/edit',
    method: 'post',
    data,
    headers: {
			isLoading: true,
		}
  })
}
// 发起合同任务
export function contractApply(params) {
  return request({
    url: '/task/contract/apply',
    method: 'post',
    params,
    headers: {
			isLoading: true,
		}
  })
}
// 新增合同任务
export function contractAdd(data) {
  return request({
    url: `/task/contract/add`,
    method: "post",
    data,
  });
}
// 查询绑定合同任务列表
export function tasksContractBindList(params) {
  return request({
    url: '/task/contract/tasksContractBindList',
    method: 'get',
    params,
  })
}
// 删除合同任务
export function contractRemove(tasksContractIds) {
  return request({
    url: '/task/contract/remove/' + tasksContractIds,
    method: 'get'
  })
}
// 查询合同任务列表
export function contractList(params) {
  return request({
    url: '/task/contract/list',
    method: 'get',
    params,
  })
}
// 获取合同任务详细信息
export function contractDetail(tasksContractId) {
  return request({
    url: '/task/contract/getInfo/' + tasksContractId,
    method: 'get'
  })
}
// 检测类型列表
export function getInspectionList() {
  return new Promise((res,rej)=>{
  	request({
  	  url: '/system/dict/data/list?pageNum=1&pageSize=1000&dictType=rh_inspection_type&status=0',
  	  method: 'get'
  	}).then(response=>{
  		let rows = [];
  		let strArr;
  		response.rows.forEach(t=>{
  			strArr = t.dictValue.split('-');
  			rows.push({
  				"inspectionTypeId":strArr[1],
  				"typeName":t.dictLabel,
  				"type":strArr[0],
  				"remarks":t.remark
  			})
  		});
  		response.rows = rows;
  		res(response);
  	})
  });
}


// 获取合同评审表和合同评审记录表内容
export function getContractReviewContentById(tasksContractId) {
  return request({
    url: '/task/tasksContractReview/get/' + tasksContractId,
    method: 'get'
  })
}
// 获取合同评审表和合同评审记录表内容2
export function getContractReviewContentById2(agreementId) {
  return request({
    url: '/basic/entrust/agreement/getContractReview/' + agreementId,
    method: 'get'
  })
}
// 生成合同评审表和合同评审记录表
export function generateContractReviewContent(tasksContractId) {
  return request({
    url: `/task/tasksContractReview/generate/${tasksContractId}`,
    method: 'post'
  })
}
// 生成合同评审表和合同评审记录表
export function generateContractReviewContent2(agreementId) {
  return request({
    url: `/basic/entrust/agreement/genContractReviewFile/${agreementId}`,
    method: 'post'
  })
}
// 保存合同评审表内容
export function saveContractReviewContent(data) {
  return request({
    url: '/task/tasksContractReview/evaluate',
    method: 'post',
    data: data
  })
}
// 保存合同评审记录表内容
export function saveContractReviewRecordContent(data) {
  return request({
    url: '/task/tasksContractReview/record',
    method: 'post',
    data: data
  })
}
// 保存合同评审记录表内容
export function saveContractReviewRecordContent2(data) {
  return request({
    url: '/basic/entrust/agreement/saveContractReview',
    method: 'post',
    data: data
  })
}saveContractReviewRecordContent2

// 生成合同
export function generateContract(tasksContractId) {
  return request({
    url: `/task/contract/createContract/${tasksContractId}`,
    method: 'post',
  })
}
// 生成任务
export function generateDetectionTogetherTask(tasksContractId) {
  return request({
    url: `/task/contract/createDetectionTogetherTask/${tasksContractId}`,
    method: 'post',
  })
}
